using System;
using JmShared;

namespace JiveMessengerLinux
{
    [System.ComponentModel.ToolboxItem(true)]
    public partial class AvatarWidget : Gtk.Bin
    {
        public AvatarWidget(UserInfo user)
        {
            this.Build();

            UpdateStatus(user);
        }


        public void UpdateStatus(UserInfo user)
        {

            this.label1.Text = user.PrettyName;
            this.label2.Text = user.ClientStatus.ToString();
            Gdk.Pixbuf pix = null;
            switch (user.ClientStatus)
            {
                case ClientStatus.Busy:
                    pix= new Gdk.Pixbuf(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("JiveMessengerLinux.Resources.avatar_border_red.png"));
                    this.image1.Pixbuf = pix;
                    break;
                case ClientStatus.Available:
                    pix = new Gdk.Pixbuf(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("JiveMessengerLinux.Resources.avatar_border_green.png"));
                    this.image1.Pixbuf = pix;
                    break;
                case ClientStatus.Afk:
                    pix = new Gdk.Pixbuf(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("JiveMessengerLinux.Resources.avatar_border_orange.png"));
                    this.image1.Pixbuf = pix;
                    break;
            }

        }
    }
}

